import 'package:flutter/material.dart';
import 'package:intro_views_flutter/intro_views_flutter.dart';
import 'package:kasax_demos2/commons/common_test_datas.dart';

/// 开场介绍
/// 多屏介绍 引导
/// https://blog.csdn.net/qq_35905501/article/details/90346746
/// https://pub.flutter-io.cn/packages/intro_views_flutter
class InteroViewsDemo extends StatefulWidget {
  const InteroViewsDemo({Key? key}) : super(key: key);

  @override
  _InteroViewsDemoState createState() => _InteroViewsDemoState();
}

class _InteroViewsDemoState extends State<InteroViewsDemo> {
  final pages = [
    PageViewModel(
        pageColor: Colors.blue,
        body: Text("海浪里的海鸥"),
        title: Text("cabs"),
        mainImage: Image.asset(
          "assets/images/${TestDatas.LOCAL_POSTER_IMGS[0]}",
          fit: BoxFit.cover,
        )),
    PageViewModel(
      pageColor: Colors.amber,
      body: Text("海滩的海鸥"),
      title: Text("Second"),
      mainImage: Image.asset("assets/images/${TestDatas.LOCAL_POSTER_IMGS[1]}",
          fit: BoxFit.cover),
    ),
    PageViewModel(
        pageColor: Colors.green,
        body: Text("村边的海鸥"),
        title: Text("Third"),
        mainImage: Image.asset("assets/images/${TestDatas.LOCAL_POSTER_IMGS[2]}",
            fit: BoxFit.cover)),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IntroViewsFlutter(
        pages,
        onTapBackButton: () {},
        onTapSkipButton: () {},
        onTapDoneButton: () {},
        showSkipButton: true,
        pageButtonTextStyles: TextStyle(
            color: Colors.white, fontSize: 18.0, fontFamily: 'Regular'),
      ),
    );
  }
}
